<script setup lang="ts">
import {TypedComponent, type TypedOptions} from "typed-vue3";
import {useRouter} from "vue-router";

const options: TypedOptions = {
  strings: ["算法", "八股文", "系统设计", "场景分析"],
  typeSpeed: 100,
  backSpeed: 100,
  loop: true,
};
let router = useRouter();
const toHome = () => {
  router.push("/problem")
}
</script>

<template>
  <div class="container">
    <div class="left-section">
      <div class="logo">
        <span class="text-pink">SageCode 代码评测平台</span>
      </div>

      <div class="submission-title">

        <TypedComponent :options="options">
          <span class="text-dark">一站搞定</span><span class="typing text-blue"/>
        </TypedComponent>
      </div>

      <div class="subtitle">
        像刷 LeetCode 一样练习编程和非编程类问题
      </div>

      <button class="start-btn" @click="toHome">
        开始刷题
      </button>
    </div>

    <div class="right-section">
      <div class="editor-preview">
        <!-- 模拟编辑器界面的示意图 -->
        <div class="toolbar">
          <div class="circle"></div>
          <div class="circle"></div>
          <div class="circle"></div>
        </div>
        <div class="content">
          <div class="line"></div>
          <div class="line"></div>
          <div class="line short"></div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10%;
  background-color: #fff;
  min-height: 80vh;
  box-sizing: border-box;
}

.left-section {
  flex: 1;
  max-width: 600px;
}

.logo {
  font-size: 42px;
  font-weight: bold;
  margin-bottom: 16px;
}

.text-pink {
  background: linear-gradient(to right, #FF69B4, #FF1493);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.submission-title {
  font-size: 42px;
  font-weight: bold;
  margin-bottom: 16px;
}

.text-dark {
  color: #333;
  margin-right: 5px;
}

.text-blue {
  background: linear-gradient(to right, #87CEEB, #1E90FF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 24px;
  color: #666;
  margin-bottom: 40px;
}

.start-btn {
  background-color: #2c3e50;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 9999px;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.start-btn:hover {
  background-color: #34495e;
}

.right-section {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  min-height: 400px;
}

.editor-preview {
  width: 100%;
  max-width: 600px;
  min-height: 300px;
  background-color: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.toolbar {
  background-color: #e9ecef;
  padding: 12px;
  display: flex;
  gap: 8px;
}

.circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #dee2e6;
}

.content {
  padding: 20px;
}

.line {
  height: 12px;
  background-color: #dee2e6;
  margin-bottom: 12px;
  border-radius: 4px;
}

.line.short {
  width: 60%;
}

/* 添加响应式布局 */
@media screen and (max-width: 1200px) {
  .container {
    padding: 0 5%;
  }
  
  .logo {
    font-size: 36px;
  }
  
  .submission-title {
    font-size: 36px;
  }
  
  .subtitle {
    font-size: 20px;
  }
  
  .right-section {
    padding: 15px;
  }
  
  .editor-preview {
    max-width: 500px;
  }
}

@media screen and (max-width: 768px) {
  .container {
    flex-direction: column;
    padding: 40px 20px;
    text-align: center;
    gap: 40px;
  }
  
  .left-section {
    margin-bottom: 40px;
  }
  
  .logo {
    font-size: 32px;
  }
  
  .submission-title {
    font-size: 32px;
  }
  
  .subtitle {
    font-size: 18px;
  }
  
  .right-section {
    padding: 0;
    min-height: 300px;
    width: 100%;
  }
  
  .editor-preview {
    max-width: 100%;
    min-height: 250px;
  }
  
  .content {
    padding: 15px;
  }
  
  .toolbar {
    padding: 8px;
  }
  
  .circle {
    width: 10px;
    height: 10px;
  }
  
  .line {
    height: 10px;
    margin-bottom: 10px;
  }
}

@media screen and (max-width: 480px) {
  .logo {
    font-size: 28px;
  }
  
  .submission-title {
    font-size: 28px;
  }
  
  .subtitle {
    font-size: 16px;
  }
  
  .start-btn {
    padding: 10px 20px;
    font-size: 16px;
  }
  
  .right-section {
    min-height: 250px;
  }
  
  .editor-preview {
    min-height: 200px;
  }
  
  .content {
    padding: 12px;
  }
  
  .line {
    height: 8px;
    margin-bottom: 8px;
  }
}
</style>
